1. Technical Field
The present invention relates to data processing apparatuses and methods, control programs therefor, and recording media having the programs recorded thereon.
2. Related Art
Universal serial bus (USB) memories that can be directly inserted in and removed from USB interfaces of personal computers (hereinafter abbreviated as “PCs”), printers, scanners, and the like have recently become widely used as highly portable removable media. In USB memories, a file system called a file allocation table (FAT) is configured in a storage region of an internal memory to manage recorded data. In the FAT file system, recorded data and a management table for managing the recorded data are recorded in different regions. Desired data can be accessed by referring to the management table. When writing data, data is recorded in a data region and the management table is updated so that the written data can be managed.
The management table may sometimes become inconsistent with the actually stored data. In particular, since USB interfaces enable so-called “hot swapping” that allows USB devices to be inserted in and removed from, for example, a PC, while it is operating, a USB memory may be removed accidentally or intentionally by the user, while data is being written to the USB memory.
When the USB memory is removed while data is being written, the data writing is forcibly interrupted. As a result, the logical consistency between the management table and the data stored in the data region cannot be guaranteed, and the data stored in the file system cannot be read accurately. A storage region may be allocated in the management table for the data that has not actually been stored, and the available storage region may be thereby reduced.
In order to avoid such a failure, operating systems such as Windows® come equipped with a function of checking file systems and repairing errors of the file systems, and such an operating system executes the function to restore and analyze the file systems in response to a user's instruction. A file system is analyzed to determine whether it is necessary to restore the file system. When the file system is restored, the file system errors are eliminated to recover the consistent and normal file system.
For a user, however, it is not clear when the file system should be restored. Therefore, the user may instruct the operating system to execute the function of restoring and analyzing the file system when it is unnecessary to do so or the user may continue using the inconsistent file system, without knowing that it is necessary to restore the file system.
In JP-A-5-2519, when a file system is accessed, the restoration of the file system is started in accordance with the previous state of a computing system at the time the computing system was shut down. Accordingly, when the computing system was not shut down properly, it is very likely that the data writing was interrupted and forcibly terminated, thereby causing file system errors. It is thus determined that it is necessary to restore the file system.
It may be determined, at a particular time, whether it is necessary to restore a file system in a removable recording medium, such as a USB memory. For example, JP-A-2003-85056 describes a technique for determining whether to restore a memory upon activation of a system. JP-A-2003-304438 describes a technique for determining whether to restore a memory upon insertion of the memory. JP-A-8-227372 describes a technique for determining whether to restore a memory upon access of a file stored in the memory.
In JP-A-5-2519, it is determined whether to restore the file system on the basis of the state of the computing system at the time the computing system was shut down. It is thus impossible to apply this technique to a file system configured in a recording medium, such as a USB memory, that can be inserted in and removed from a system, while the system is operating. Since the technique described in JP-A-2003-85056 determines whether to restore the memory upon activation of the system (upon turning on the power), the technique cannot be similarly applied to a file system in a recording medium that can be inserted in and removed from a system, while the system is operating.
The techniques described in JP-A-2003-304438 and JP-A-8-227372 involve always analyzing the memory at a predetermined time to determine the need to restore the memory, the relatively time-consuming analysis of the memory is performed even when it is not always necessary to restore the memory. As a result, the activation of the system takes a longer time, or the system resources are allocated to the analysis at the particular time. Therefore, it is very difficult to efficiently maintain a normal file system.